/**
 * 
 */
package lab6;


import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * @author Nican
 *
 */
public class JTestBuyCandy extends TestCase{
	Vending vending;
	
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		vending = new Vending(10, 10);
	}
	
	@Test public void testAddMoney(){
		
		double oldBalance = vending.getBalance();
		
		vending.addMoney(1.25);
		
		assertTrue( vending.getBalance() == (oldBalance + 1.25) );
		
		vending.select("Candy");
		
		assertTrue( vending.getBalance() == oldBalance );
		
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
		vending = null;
	}

}
